import logging
from config import BASE_HOST


class TenderApi:

    def __init__(self,session):
        self.session=session

    # 获取session对象

    # 投资接口
    def tender(self,id_v,amount_v,depositCertificate=-1,):
        url=(BASE_HOST+'/trust/trust/tender')
        data={"id":id_v,'depositCertificate':depositCertificate,'amount':amount_v}
        resp=self.session.post(url,data=data)
        logging.info(f'获取投资接口返回的响应数据{resp.json()}')
        return resp

    # 第三方投资接口
    def third_tender(self,url,form_dict):
        response = self.session.post(url=url, data=form_dict)
        logging.info(f'开户接口{response.text}')
        # 封装方法的返回
        return response